<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>产品管理表</title>
<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- 搜索区域开始 -->
	<form class="layui-form">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">产品名字</label>
				<div class="layui-input-inline" style="width: 100px;">
					<input type="text" name="name" autocomplete="off"
						class="layui-input">
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">范围</label>
				<div class="layui-input-inline" style="width: 100px;">
					<input type="text" name="minPrice" placeholder="￥"
						autocomplete="off" class="layui-input">
				</div>
				<div class="layui-form-mid">-</div>
				<div class="layui-input-inline" style="width: 100px;">
					<input type="text" name="maxPrice" placeholder="￥"
						autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">类型</label>
				<div class="layui-input-inline" style="width: 100px;">
					<select name="protype" class="protypes">
						<option value="">--请选择--</option>
					</select>
				</div>
			</div>
			<button class="layui-btn" lay-submit lay-filter="souBtn">
				<i class="layui-icon layui-icon-search"></i>搜索
			</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</form>
	<!-- 搜索区域结束 -->

	<!-- 表格容器 -->
	<table id="demo" lay-filter="test"></table>

	<!-- 头部工具栏开始 -->
	<script type="text/html" id="toolbarDemo1">
         <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add"> <i class="layui-icon">&#xe654;</i>添加</button>
         </div>
     </script>
	<!-- 头部工具栏结束 -->
	<!-- 行内工具栏开始 -->
	<script type="text/html" id="toolbarDemo2">
          <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete"> <i class="layui-icon">&#xe640;</i>删除</button>
            <button class="layui-btn layui-btn-sm" lay-event="update"> <i class="layui-icon">&#xe642;</i>编辑</button>
            <button class="layui-btn layui-btn-sm" lay-event="tu">详情图片</button>
          </div>
     </script>
	<!-- 行内工具栏结束 -->

	<!-- 添加的表单 -->
	<div id="addDiv" style="display: none; width: 1000">
		<form class="layui-form" lay-filter="addForm">
			<div class="layui-form-item">
				<label class="layui-form-label">产品名字</label>
				<div class="layui-input-inline">
					<input type="text" name="proname" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label" name="url">url</label>
				<div class="layui-input-inline">
					<!-- 上传图片按钮 -->
					<button type="button" class="layui-btn" id="test1">
						<i class="layui-icon">&#xe67c;</i>上传图片
					</button>
					<!-- 展示上传成功的图片 -->
					<img id="showImg" src="" width="50">
					<!-- 用来储存上传成功之后的图片路径 -->
					<input type="text" name="picurl" id="url" required
						lay-verify="required" placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>
			
			<div class="layui-inline">
				<label class="layui-form-label">产品类别</label>
				<div class="layui-input-inline" style="width: 100px;">
					<select name="protype" class="protypes">
						<option value="">--请选择--</option>
					</select>
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">产品市场价</label>
				<div class="layui-input-inline">
					<input type="text" name="market" required lay-verify="number"
						placeholder="请输入市场价" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">公司产品价格</label>
				<div class="layui-input-inline">
					<input type="text" name="price" required lay-verify="number"
						placeholder="请输入价格" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">产品品牌</label>
				<div class="layui-input-inline">
					<input type="text" name="brand" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">产品风格</label>
				<div class="layui-input-inline">
					<input type="text" name="style" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">产品材质</label>
				<div class="layui-input-inline">
					<input type="text" name="material" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">是否组装</label>
				<div class="layui-input-inline">
					<input type="text" name="zuzhuang" required lay-verify="required"
						placeholder="请输入是 或者 不是" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">是否需要定制</label>
				<div class="layui-input-inline">
					<input type="text" name="dingzhi" required lay-verify="required"
						placeholder="请输入是 或 否" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">是否首页展示</label>
				<div class="layui-input-inline">
					<input type="text" name="isShow" required lay-verify="required"
						placeholder="请输入是 或者  否" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">产品型号</label>
				<div class="layui-input-inline">
					<input type="text" name="model" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">设计元素</label>
				<div class="layui-input-inline">
					<input type="text" name="element" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
			<label class="layui-form-label">产品颜色</label>
				<div class="layui-input-inline">
					<input type="text" name="color" required lay-verify="required"
						placeholder="请输入对应颜色" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">款式定位</label>
				<div class="layui-input-inline">
					<input type="text" name="positioning" required
						lay-verify="required" placeholder="请输入" autocomplete="off"
						class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
	<!-- 添加的表单结束 -->

	<!-- 修改的表单开始 -->
	<div id="updDiv" style="display: none; width: 1000">
		<form class="layui-form" lay-filter="updForm">
			<div class="layui-form-item">
				<label class="layui-form-label">产品id</label>
				<div class="layui-input-inline">
					<input type="text" name="id" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
				
				<label class="layui-form-label">产品名字</label>
				<div class="layui-input-inline">
					<input type="text" name="proname" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" name="url">添加图片</label>
				<div class="layui-input-inline">
					<button type="button" class="layui-btn" id="test2">
						<i class="layui-icon">&#xe67c;</i>上传图片
					</button>
					<!-- 展示上传成功的图片 -->
					<img id="showImg2" src="" width="50">
					<!-- 回显图片地址 -->
					<input type="text" name="picurl" id="url2" required
						lay-verify="required" placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
				<label class="layui-form-label">产品类别</label>
				<div class="layui-input-inline" style="width: 100px;">
					<select name="protype" class="protypes">
						<option value="">--请选择--</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">产品颜色</label>
				<div class="layui-input-inline">
					<input type="text" name="color" required lay-verify="required"
						placeholder="请输入对应颜色" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">产品市场价</label>
				<div class="layui-input-inline">
					<input type="text" name="market" required lay-verify="number"
						placeholder="请输入市场价" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">公司产品价格</label>
				<div class="layui-input-inline">
					<input type="text" name="price" required lay-verify="number"
						placeholder="请输入价格" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">产品品牌</label>
				<div class="layui-input-inline">
					<input type="text" name="brand" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">产品风格</label>
				<div class="layui-input-inline">
					<input type="text" name="style" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">产品材质</label>
				<div class="layui-input-inline">
					<input type="text" name="material" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">是否组装</label>
				<div class="layui-input-inline">
					<input type="text" name="zuzhuang" required lay-verify="required"
						placeholder="请输入是 或者 否" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">是否需要定制</label>
				<div class="layui-input-inline">
					<input type="text" name="dingzhi" required lay-verify="required"
						placeholder="请输入是 或 否" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">是否首页展示</label>
				<div class="layui-input-inline">
					<input type="text" name="isShow" required lay-verify="required"
						placeholder="请输入是 或者  否" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">产品型号</label>
				<div class="layui-input-inline">
					<input type="text" name="model" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">设计元素</label>
				<div class="layui-input-inline">
					<input type="text" name="element" required lay-verify="required"
						placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">款式定位</label>
				<div class="layui-input-inline">
					<input type="text" name="positioning" required
						lay-verify="required" placeholder="请输入" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo2">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
	<!-- 修改的表单结束 -->
	<!-- 详情图的表单开始 -->
	<div id="tuDiv" style="display: none; width: 7000">
		<table id="tutab" lay-filter="tutab"></table>
	</div>
	<!-- 详情图的表单结束 -->
	<!-- 详情图头部工具栏开始 -->
	<script type="text/html" id="toolbarDemo3">
         <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add2">添加</button>
         </div>
     </script>
	<!-- 详情图头部工具栏结束 -->
	<!-- 详情图行内工具栏开始 -->
	<script type="text/html" id="toolbarDemo4">
          <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete2">删除</button>
            <button class="layui-btn layui-btn-sm" lay-event="update2">编辑</button>
          </div>
     </script>
	<!-- 详情图行内工具栏结束 -->

	<!-- 详情图添加的表单开始-->
	<div id="addDiv2" style="display: none; width: 1000">
		<form class="layui-form" style="width: 400px;" lay-filter="addForm2">
			<div class="layui-form-item">
				<label class="layui-form-label" name="url">url</label>
				<div class="layui-input-inline">
					<!-- 上传图片按钮 -->
					<button type="button" class="layui-btn" id="test3">
						<i class="layui-icon">&#xe67c;</i>上传图片
					</button>
					<!-- 展示上传成功的图片 -->
					<img id="showImg3" src="" width="50">
					<!-- 用来储存上传成功之后的图片路径 -->
					<input type="text" name="url" id="url3" required
						lay-verify="required" placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">对应产品id</label>
				<div class="layui-input-inline">
					<input type="text" name="productid" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled" id="ptId">
				</div>
			</div>


			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo3">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
	<!-- 详情图添加的表单结束-->

	<!-- 详情图修改的表单开始-->
	<div id="updDiv2" style="display: none; width: 1000">
		<form class="layui-form" style="width: 400px;" lay-filter="updForm2">
			<div class="layui-form-item">
				<label class="layui-form-label">id</label>
				<div class="layui-input-inline">
					<input type="text" name="id" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" name="url">添加图片</label>
				<div class="layui-input-inline">
					<button type="button" class="layui-btn" id="test4">
						<i class="layui-icon">&#xe67c;</i>上传图片
					</button>
					<!-- 展示上传成功的图片 -->
					<img id="showImg4" src="" width="50">
					<!-- 回显图片地址 -->
					<input type="text" name="url" id="url4" required
						lay-verify="required" placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">对应产品id</label>
				<div class="layui-input-inline">
					<input type="text" name="productid" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo4">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
	<!-- 详情图修改的表单结束-->


	<!-- 脚本开始 -->
	<script>
		layui.use([ 'table', 'form', 'layer', 'upload' ], function() {
			var table = layui.table;
			var form = layui.form;
			var layer = layui.layer;
			var $ = layui.$;
			var upload = layui.upload;

			//表格渲染开始
			table.render({
				elem : '#demo',
				url : 'ProductServletAdmin?method=getList', 
				page : true, //开启分页
				id : "idTest",
				toolbar : '#toolbarDemo1',
				cols : [ [ //表头
				{
					field : 'id',
					title : 'ID',
					width : 80,
					sort : true,
				}, {
					field : 'proname',
					title : '产品名',
					width : 90
				}, {
					field : 'Picurl',
					title : '产品图片地址',
					width : 150,
					templet : function(d) {
						return '<img width="50" src="../'+d.picurl+'"/>'
					}
				}, {
					field : 'protype',
					title : '产品类别id',
					width : 100,
				}, {
					field : 'typename',
					title : '产品类别',
					width : 100,
				}, {
					field : 'price',
					title : '售价',
					width : 80,
					sort : true
				}, {
					field : 'zuZhuang',
					title : '是否组装',
					width : 80,
				}, {
					field : 'dingzhi',
					title : '是否需要定制',
					width : 100,
				}, {
					field : 'isShow',
					title : '是否在首页展示',
					width : 130,
				}, {
					title : '操作',
					width : 235,
					toolbar : '#toolbarDemo2'
				} ] ]
			});//表格渲染结束

			//监听事件--头部工具栏监听开始
			table.on('toolbar(test)', function(obj) {
				if (obj.event == "add") {
					// layer.msg('添加');
					layer.open({
						type : 1,
						content : $('#addDiv'),
						area: ['800px', '600px']
					});
				}
			});//监听事件--头部工具栏监听结束

			//监听提交----搜索按钮
			form.on('submit(souBtn)', function(data) {
				table.reload('idTest', {
					where : data.field
				});
				return false;
			});

			//监听事件--行内工具栏监听开始
			table.on('tool(test)', function(obj) {
				var data = obj.data;
				switch (obj.event) {
				case 'delete':
					layer.confirm('真的删除行么' + data.id, function(index) {

						//向服务端发送删除指令
						$.post("ProductServletAdmin?method=delProById", {
							"id" : data.id
						}, function(res) {
							if (res.code == 0) {
								obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
							}
							layer.close(index);
							layer.msg(res.msg);
						}, "json")
					});
					break;
				case 'update':
					//layer.msg('编辑');
					//弹窗
					layer.open({
						type : 1,
						content : $('#updDiv'),
						area: ['800px', '600px']
					});
					
					form.val("updForm", data);
					$("#showImg2").attr("src", "../" + data.picurl);
					break;
				case 'tu':
					//layer.msg('编辑');
					$("#ptId").val(data.id);
					//弹窗
					layer.open({
						type : 1,
						content : $('#tuDiv')
					});
					table.render({
						elem : '#tutab',
						url : 'ImagesServletAdmin?method=getProList&pid='
								+ data.id,//数据接口
						toolbar : '#toolbarDemo3',
						id : "idTest2",
						cols : [ [ //表头
						{
							field : 'id',
							title : 'ID',
							width : 80,
							sort : true,
							fixed : 'left'
						}, {
							field : 'url',
							title : '图片',
							width : 100,
							templet : function(d) {
								return '<img width="50" src="../'+d.url+'"/>'
							}
						}, {
							field : 'productid',
							title : '产品id',
							width : 90,
							sort : true
						}, {
							title : '操作',
							width : 177,
							toolbar : '#toolbarDemo4'
						} ] ]
					});
					break;
				}
			});//监听事件--行内工具栏监听结束

			//详情图片的按钮监听及使用开始
			//监听事件添加--头部工具栏监听开始
			table.on('toolbar(tutab)', function(obj) {
				if (obj.event == "add2") {
					// layer.msg('添加');
					layer.open({
						type : 1,
						content : $('#addDiv2')
					//添加div弹窗的id
					});
				}
			});//监听事件--头部工具栏监听结束

			//监听事件--行内工具栏监听开始
			table.on('tool(tutab)', function(obj) {
				var data = obj.data;//当前行内数据
				switch (obj.event) {
				case 'delete2':
					layer.confirm('真的删除行么', function(index) {
						obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
						layer.close(index);
						//向服务端发送删除指令
						$.post("ImagesServletAdmin?method=delImagesById", {
							"id" : data.id
						}, function(res) {
							layer.msg(res.msg);
						}, "json")
					});
					break;
				case 'update2':
					//layer.msg('编辑');
					//弹窗
					layer.open({
						type : 1,
						content : $('#updDiv2')
					});
					//数据回显
					form.val("updForm2", data);
					$("#showImg4").attr("src", "../" + data.url);//展示图片
					break;
				}
			});//监听事件--行内工具栏监听结束

			//监听表单提交--添加
			form.on('submit(formDemo3)', function(data) {
				//layer.msg(JSON.stringify(data.field));
				$.post("ImagesServletAdmin?method=insertImages", data.field,
						function(res) {
							console.log(res);
							if (res.code == 0) {
								layer.msg(res.msg, {
									time : 1000
								}, function() {
									layer.closeAll();//关闭所有窗口
									table.reload('idTest2', {});//表格重载（根据表格id执行）
								})
							}
						}, "json")
				return false;
			});//监听表单提交结束

			//监听表单提交--修改
			form.on('submit(formDemo4)', function(data) {
				//layer.msg(JSON.stringify(data.field));
				$.post("ImagesServletAdmin?method=updImages", data.field,
						function(res) {
							console.log(res);
							if (res.code == 0) {
								layer.msg(res.msg, {
									time : 1000
								}, function() {
									layer.closeAll();//关闭所有窗口
									table.reload('idTest2', {});//表格重载（根据表格id执行）
								})
							}
						}, "json")
				return false;
			});//监听修改表单提交结束--修改

			//图片上传执行实例---添加
			var uploadInst = upload.render({//upload.render表示渲染
				elem : '#test3',//绑定元素
				url : 'ImgServletAdmin?method=uploadImg', //上传接口
				done : function(res) {
					//上传完毕回调
					console.log(res);
					if (res.code == 0) {
						$("#showImg3").attr("src", "../images/" + res.data);//展示图片
						$("#url3").val("images/" + res.data);//url的路径
					}
				},
				error : function() {
					//请求异常回调
				}
			});//图片上传执行实例结束

			//图片上传执行实例---修改
			var uploadInst = upload.render({//upload.render表示渲染
				elem : '#test4',//绑定元素
				url : 'ImgServletAdmin?method=uploadImg', //上传接口
				done : function(res) {
					//上传完毕回调
					console.log(res);
					if (res.code == 0) {
						$("#showImg4").attr("src", "../images/" + res.data);//展示图片
						$("#url4").val("images/" + res.data);//url的路径
					}
				},
				error : function() {
					//请求异常回调
				}
			});//图片修改执行实例结束

			//详情图片的按钮监听及使用结束

			//监听表单提交--添加
			form.on('submit(formDemo)', function(data) {
				//layer.msg(JSON.stringify(data.field));
				$.post("ProductServletAdmin?method=insertProduct", data.field,
						function(res) {
							console.log(res);
							if (res.code == 0) {
								layer.msg(res.msg, {
									time : 1000
								}, function() {
									layer.closeAll();//关闭所有窗口
									table.reload('idTest', {});//表格重载（根据表格id执行）
								})
							}
						}, "json")
				return false;
			});//监听表单提交结束--添加

			//监听表单提交--修改
			form.on('submit(formDemo2)', function(data) {
				//layer.msg(JSON.stringify(data.field));
				$.post("ProductServletAdmin?method=updatePro", data.field,
						function(res) {
							console.log(res);
							if (res.code == 0) {
								layer.msg(res.msg, {
									time : 1000
								}, function() {
									layer.closeAll();//关闭所有窗口
									table.reload('idTest', {});//表格重载（根据表格id执行）
								})
							}
						}, "json")
				return false;
			});//监听修改表单提交结束--修改

			//图片上传执行实例---添加
			var uploadInst = upload.render({//upload.render表示渲染
				elem : '#test1',//绑定元素
				url : 'ImgServletAdmin?method=uploadImg', //上传接口
				done : function(res) {
					//上传完毕回调
					console.log(res);
					if (res.code == 0) {
						$("#showImg").attr("src", "../images/" + res.data);//展示图片
						$("#url").val("images/" + res.data);//url的路径
					}
				},
				error : function() {
					//请求异常回调
				}
			});//图片上传执行实例结束

			//图片上传执行实例---修改
			var uploadInst = upload.render({//upload.render表示渲染
				elem : '#test2',//绑定元素
				url : 'ImgServletAdmin?method=uploadImg', //上传接口
				done : function(res) {
					//上传完毕回调
					console.log(res);
					if (res.code == 0) {
						$("#showImg2").attr("src", "../images/" + res.data);//展示图片
						$("#url2").val("images/" + res.data);//url的路径
					}
				},
				error : function() {
					//请求异常回调
				}
			});//图片修改执行实例结束

			//异步请求获取产品类型
			//1、ajax请求服务端获取：产品类型
			$.post("ProductServletAdmin?method=getProtypList", function(res) {
				console.log(res);
				if (res.code == 0) {
					//2、将获取的数据，重新渲染在下拉列表中
					for (var i = 0; i < res.data.length; i++) {
						$(".protypes").append(
								"<option value='"+res.data[i].id+"'>"
										+ res.data[i].typename + "</option>)")
					}
					//3、刷新select选择框渲染
					form.render('select');
				}
			}, "json")

		});//脚本结束
	</script>
</body>
</html>